From 1dd55ed6006a32e952ed418852c111d5abbc7a1b Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Fri, 18 Oct 2019 08:47:07 -0500 Subject: [PATCH] Drop gtk_icon_info_new_for_pixbuf It is better to keep icon infos as something you only get from the icon theme. --- docs/reference/gtk/gtk4-sections.txt | 1 - gtk/gtkicontheme.c | 38 ++++++++++------------------ gtk/gtkicontheme.h | 4 --- 3 files changed, 13 insertions(+), 30 deletions(-) diff --git a/docs/reference/gtk/gtk4-sections.txt b/docs/reference/gtk/gtk4-sections.txt index ca90aca5b1..6a246c8e9a 100644 --- a/docs/reference/gtk/gtk4-sections.txt +++ b/docs/reference/gtk/gtk4-sections.txt @@ -5311,7 +5311,6 @@ gtk_icon_theme_load_icon_for_scale gtk_icon_theme_list_icons gtk_icon_theme_get_icon_sizes gtk_icon_theme_rescan_if_needed -gtk_icon_info_new_for_pixbuf gtk_icon_info_get_base_size gtk_icon_info_get_base_scale gtk_icon_info_get_filename diff --git a/gtk/gtkicontheme.c b/gtk/gtkicontheme.c index 2baf09134c..4a79febdee 100644 --- a/gtk/gtkicontheme.c +++ b/gtk/gtkicontheme.c @@ -4280,6 +4280,19 @@ gtk_icon_info_new_for_file (GFile *file, return info; } +static GtkIconInfo * +gtk_icon_info_new_for_pixbuf (GtkIconTheme *icon_theme, + GdkPixbuf *pixbuf) +{ + GtkIconInfo *info; + + info = icon_info_new (ICON_THEME_DIR_UNTHEMED, 0, 1); + info->texture = gdk_texture_new_for_pixbuf (pixbuf); + info->scale = 1.0; + + return info; +} + /** * gtk_icon_theme_lookup_by_gicon_for_scale: * @self: a #GtkIconTheme @@ -4380,28 +4393,3 @@ gtk_icon_theme_lookup_by_gicon_for_scale (GtkIconTheme *self, return NULL; } - -/** - * gtk_icon_info_new_for_pixbuf: - * @icon_theme: a #GtkIconTheme - * @pixbuf: the pixbuf to wrap in a #GtkIconInfo - * - * Creates a #GtkIconInfo for a #GdkPixbuf. - * - * Returns: (transfer full): a #GtkIconInfo - */ -GtkIconInfo * -gtk_icon_info_new_for_pixbuf (GtkIconTheme *icon_theme, - GdkPixbuf *pixbuf) -{ - GtkIconInfo *info; - - g_return_val_if_fail (GTK_IS_ICON_THEME (icon_theme), NULL); - g_return_val_if_fail (GDK_IS_PIXBUF (pixbuf), NULL); - - info = icon_info_new (ICON_THEME_DIR_UNTHEMED, 0, 1); - info->texture = gdk_texture_new_for_pixbuf (pixbuf); - info->scale = 1.0; - - return info; -} diff --git a/gtk/gtkicontheme.h b/gtk/gtkicontheme.h index 9345af71b0..6f96f3e246 100644 --- a/gtk/gtkicontheme.h +++ b/gtk/gtkicontheme.h @@ -205,10 +205,6 @@ gboolean gtk_icon_theme_rescan_if_needed (GtkIconTheme GDK_AVAILABLE_IN_ALL GType gtk_icon_info_get_type (void) G_GNUC_CONST; -GDK_AVAILABLE_IN_ALL -GtkIconInfo * gtk_icon_info_new_for_pixbuf (GtkIconTheme *icon_theme, - GdkPixbuf *pixbuf); - GDK_AVAILABLE_IN_ALL gint gtk_icon_info_get_base_size (GtkIconInfo *self); GDK_AVAILABLE_IN_ALL -- 2.30.2